package cn.zyjw.mapper;

import cn.zyjw.domain.SysMenu;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface SysMenuMapper extends BaseMapper<SysMenu> {

    @Select("SELECT sm.* FROM sys_menu sm " +
            "LEFT JOIN sys_role_menu srm ON srm.menu_id = sm.id " +
            "LEFT JOIN sys_user_role sur ON sur.role_id = srm.role_id " +
            "WHERE sur.user_id = #{userId}")
    List<SysMenu> selectMenusByUserId(Long userId);
}